package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountCustomerDetailsPartnersTabPageUtil extends SeleniumPageUtil {
	
	public final static By CDGT_SPAN_MAIN_HEADER = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_Header_lblHeader");
	public final static By CDGT_IMG_REPORT_PREFERENCES = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_Header_imgPreferences");
	public final static By CDGT_IMG_EXPORT = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_Header_imgExcelExport");
	public final static By CDGT_TD_PAGE = By.xpath("//*[@id='ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]");
	public final static By CDGT_SPAN_PAGE_START_NO = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_lblPagingPageNumber");
	public final static By CDGT_TD_OF = By.xpath("//*[@id='ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[3]");
	public final static By CDGT_SPAN_PAGE_COUNT = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_lblPagingPageCount");
	public final static By CDGT_INPUT_FIRST = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_imgFirst");
	public final static By CDGT_INPUT_PREVIOUS = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_imgPrevious");
	public final static By CDGT_INPUT_NEXT = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_imgNext");
	public final static By CDGT_INPUT_LAST = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_PagingTop_imgLast");
	public final static By CDGT_IMG_FILTER_0 = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_filter_0");
	public final static By CDGT_IMG_FILTER_1 = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_filter_1");
	public final static By CDGT_IMG_FILTER_2 = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_filter_2");
	public final static By CDGT_TH_CUSTOMER_NAME = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_sort_0");
	public final static By CDGT_TH_CUSTOMER_CODE = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_sort_1");
	public final static By CDGT_TH_IS_SMS = By.id("ParentChildContainer_CustomerDetails_Partners1_PartnerReport_sort_2");
	
	
	public static void enterYourAccountCustomerDetailsPartnersPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterYourAccountCustomerDetailsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountCustomerDetailsDefaultPageUtil.YACD_TAB_PARTNERS));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				CDGT_IMG_REPORT_PREFERENCES, CDGT_IMG_EXPORT, CDGT_INPUT_FIRST, CDGT_INPUT_PREVIOUS, CDGT_INPUT_NEXT,
				CDGT_INPUT_LAST, CDGT_IMG_FILTER_0, CDGT_IMG_FILTER_1, CDGT_IMG_FILTER_2
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_IMG_REPORT_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_INPUT_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_IMG_FILTER_0));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_IMG_FILTER_1));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDGT_IMG_FILTER_2));
	}
}
